﻿namespace CV.Bll.Impl
{
    using CV.Entities.Dto;
    using CV.Interfaces.Bll;
    using CV.Interfaces.Dal;
    using System;
    using System.Collections.Generic;

    public class UserService : IUserService
    {
        private IUserAO userAO;

        public UserService(IUserAO userAO)
        {
            this.userAO = userAO;
        }

        public User GetUserById(Guid id)
        {
            return userAO.GetById(id);
        }

        public User Create(User user)
        {
            return userAO.Create(user);
        }

        public IEnumerable<User> List(int page, string sort, bool asc, out int count)
        {
            return userAO.List(page, sort, asc, out count);
        }

        public IEnumerable<User> ListAll()
        {
            return userAO.ListAll();
        }

        public void Delete(Guid id)
        {
            userAO.Delete(id);
        }

        public void Update(User user)
        {
            userAO.Update(user);
        }

        public bool ValidateUser(string username, string password)
        {
            return userAO.ValidateUser(username, password);
        }
    }
}
